package com.manjusaka.structure7.Proxy;

/**
 * 设计模式之代理模式
 * Created by manjusaka on 2017/7/11.
 */
public class ProxyPattern {
}

class User {
    private User() {
    }

    private static final class HolderClass {
    private static final User INSTANCE=new User();
    }
    public static User getInstance(){
        return HolderClass.INSTANCE;
    }

    public User getUser(long uid) {
        return new User();
    }
}

class Proxy {
    private User user = com.manjusaka.structure7.Proxy.User.getInstance();

    public boolean getUserAndCheckUser(long uid) {
        User use = user.getUser(uid);
        if (use != null) {
            return true;
        }
        return false;
    }
}
